import request from '@/utils/http'

// 查询角色全部数据
export function fetchList(query) {
  return request({
    url: '/role',
    method: 'get',
    params: query
  })
}

//查询所有权限(层级)
export function getLevelPerms(query) {
  return request({
    url: '/permission/levelPerms',
    method: 'get',
    params: query
  })
}

//根据角色id查询权限
export function getPermsByRoleId(id) {
  return request({
    url: `/permission/queryByRoleId/${id}`,
    method: 'get',
  })
}

// 分配权限
//查询所有权限(层级)
export function assign(data) {
  return request({
    url: '/role/assignPerms',
    method: 'post',
    data
  })
}
